package org.little.test.service;

import java.util.HashMap;
import java.util.Map;

import org.little.test.model.SysUser;
import org.little.test.repository.SysUserDao;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;


/**
 * Title:
 * Desc:
 * User: crespo
 * Company: www.gitv.cn
 * Date: 13-11-22 下午12:05
 */
@Component
@Transactional(readOnly = true)
public class SysUserService {

    private static final Logger logger = LoggerFactory.getLogger(SysUserService.class);
    @Autowired
    private SysUserDao sysUserDao;

    public SysUser getEffectiveUserByLoginName(String loginName) {
        return sysUserDao.findByIsEffectiveAndLoginName(1, loginName);
    }


//    public boolean hasUserFuncRelation(Integer userId, Integer funcId){
//        Map<String, Object> params = new HashMap<String, Object>();
//        params.put("userId", userId);
//        params.put("funcId", funcId);
//        int relCount = sysUserDao.countUserFuncRelation(params);
//        if(relCount > 0){
//            return true;
//        }
//        return false;
//    }
}
